<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><{$tt}></title>
<script type="text/javascript" src="<{$smarty.const.WEBDIR}>js/jquery.min.js"></script>
<script type="text/javascript" src="<{$smarty.const.WEBDIR}>js/admin.js"></script>
<link href="<{$smarty.const.BASEPATH}>/css/base.css" rel="stylesheet"/>
<link href="<{$smarty.const.BASEPATH}>/css/admin_style.css" rel="stylesheet"/>
</head>

<body>
   <form action="<{spUrl c=products a=select_Relate}>" method="post">

   <table width="100%" style="table-layout:fixed;" class="tdsize">
   <tr>
   <td width="50">*检索：</td>
   <td style="text-align: left;"><input type="text" value="<{$title}>" id="title" name="title"/> <select name="parent_id" id="parent_id">
<option value="">全部分类</option>
<{function name=menu level=0}> 
<{for $i=0 to $i<$level*2-1}>    
<{$str=$str|cat:'　'}>
<{/for}>
<{if $level++}>
<{$str2= $str|cat:'├'}>
<{/if}>
<{foreach $data as $entry}> 
<option value='<{$entry.categories_id}>' <{if $entry.categories_id==$parent_id}>selected='selected'<{/if}><{if isset($entry.child)}>disabled="disabled"<{/if}>><{$str2}><{$entry.detail.categories_name}></option>
<{if isset($entry.child)}>             
<{call name=menu data=$entry.child level=$level}>           
<{/if}> 
<{/foreach}>  
<{/function}> 

<{call name=menu data=$arr}> 
</select>  <input type="hidden" value="<{$news_Relate}>" id="news_Relate" name="news_Relate"/></td></tr>       
        <tr>
            <td>*商品：</td>
            <td style="text-align: left;">
            <ul id="prolist">
            <{foreach item=item name=name from=$products_arr}>
            <li><input type="checkbox" name="select_Relate" onclick="hp(this.value)" value="<{$item.products_id}>"<{if $item.relate}> checked="checked"<{/if}>/><img src="<{$smarty.const.WEBDIR}>upload/<{$item.products_image}>" width="60" title="<{$item.detail.products_name}>"/></li>
            <{/foreach}>
            </ul>
            </td>
        </tr>
    </table>
    <br /><br />
<div id="submit_float"><div style="float:left">
<input name="Submit1" type="submit" value="查询" />
   </div>
   <div style="float:right">
   <{if $tPageBar ne null}>
                    <div id="pager">
                    	分页 <a href="#" onclick="window.location='<{spUrl c=products a=select_Relate parent_id=$parent_id page=$tPageBar.prev_page size=$tPageBar.page_size}>&news_Relate='+$('#news_Relate').val()"><img src="<{$smarty.const.BASEPATH}>/images/admin/img/icons/arrow_left.gif" width="16" height="16" border="0" /></a> 
                    	<input size="2" value="<{$tPageBar.current_page}>" type="text" name="page" id="page" /> 
                    	<a href="#" onclick="window.location='<{spUrl c=products a=select_Relate parent_id=$parent_id page=$tPageBar.next_page size=$tPageBar.page_size}>&news_Relate='+$('#news_Relate').val()"><img src="<{$smarty.const.BASEPATH}>/images/admin/img/icons/arrow_right.gif" width="16" height="16" border="0" /></a>共 <{$tPageBar.total_page}>
                    页 | 显示 
                     <select id="size" name="size" onchange="window.location='<{spUrl c=products a=select_Relate parent_id=$parent_id news_Relate=$news_Relate page=$tPageBar.current_page}>&news_Relate='+$('#news_Relate').val()+'&size='+this.value">
                    				<option <{if $tPageBar.page_size eq 10}>selected="selected"<{/if}> value="10">10</option>
                                    <option <{if $tPageBar.page_size eq 20}>selected="selected"<{/if}> value="20">20</option>
                                    <option <{if $tPageBar.page_size eq 50}>selected="selected"<{/if}> value="50">50</option>
                                    <option <{if $tPageBar.page_size eq 100}>selected="selected"<{/if}> value="100">100</option>
                    			</select> 
                    每页 | 共 <strong><{$tPageBar.total_count}></strong> 条记录
                    </div>
                    <{/if}></div>
   </div>
</form>
<script type="text/javascript">
function hp(products_id){
    //alert(products_id);
    
    
    
        if($("#news_Relate").val()==""){
        $("#news_Relate").val($("#news_Relate").val()+products_id);
        //window.parent.document.getElementById('news_Relate').value=products_id;
        $("#news_Relate",window.parent.document).val(products_id); 
        }else{
            news_Relate_value_arr = $("#news_Relate").val().split(",");// 在每个逗号(,)处进行分解。
            TF=inarray(products_id,news_Relate_value_arr);
            if(TF){
                //如果存在就去掉它
                news_Relate_value_arr.splice(TF,1);
                //alert(test);
                $("#news_Relate").val(news_Relate_value_arr);
                $("#news_Relate",window.parent.document).val(news_Relate_value_arr); 
               
            }else{
                $("#news_Relate").val($("#news_Relate").val()+','+products_id);
                 $("#news_Relate",window.parent.document).val($("#news_Relate",window.parent.document).val()+','+products_id); 
                //window.parent.document.getElementById('news_Relate').value+=','+products_id;
            }

        }
    
}

</script>
</body>

</html>